#include<bits/stdc++.h>
using namespace std;

int dx[] = {-2, -1, 1, 2, 2, 1, -1, -2};
int dy[] = {1, 2, 2, 1, -1, -2, -2, -1};
int m, n, qx, qy;
bool vis[100][100];
int num;

bool check()
{
	for(int i = 0;i < n;i++)
		for(int j = 0;j < m;j++)
			if(!vis[i][j])
				return false;
	return true;
}

void dfs(int x, int y, int step)
{
	if(step == m*n)
	{
		if(check())
			num++;
		return ;
	}
	for(int i = 0;i < 8;i++)
	{
		int xx = x+dx[i];
		int yy = y+dy[i];
		if(xx >= 0 && yy >= 0 && xx < n && yy < m && !vis[xx][yy])
		{
			vis[xx][yy] = 1;
			dfs(xx, yy, step+1);
			vis[xx][yy] = 0;
		}
	}
}

int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		cin>>n>>m>>qx>>qy;
		num = 0;
		memset(vis, 0, sizeof vis);
		vis[qx][qy] = 1;
		dfs(qx, qy, 1);
		cout<<num<<endl;
	}
	cout<<endl;
	system("pause"); 
	return 0;
}

